import 'package:favorcate/core/model/category_model.dart';
import 'package:favorcate/ui/pages/meal/meal.dart';
import 'package:favorcate/ui/shared/extension/int_extension.dart';
import 'package:flutter/material.dart';

class ZSHomeCategoryItem extends StatelessWidget {
  final ZSCategoryModel _category;

  ZSHomeCategoryItem(this._category);

  @override
  Widget build(BuildContext context) {
    final bgColor = _category.cColor;

    return GestureDetector(
      child: Container(
          alignment: Alignment.center,
          decoration: BoxDecoration(
            color: bgColor,
            borderRadius: BorderRadius.circular(24.px),
            gradient:
                LinearGradient(colors: [bgColor.withOpacity(0.5), bgColor]),
          ),
          child: Text(_category.title,
              style: Theme.of(context)
                  .textTheme
                  .headline3
                  ?.copyWith(fontWeight: FontWeight.bold))),
      onTap: () {
        Navigator.of(context)
            .pushNamed(ZSMealScreen.routeName, arguments: _category);
      },
    );
  }
}
